#include<iostream>
#include<cstring>
using namespace std;
void get_next(char s[], int next[])
{
	int len = strlen(s);
	int j = 0;
	int k = -1;
	next[0] = -1;
	while (j < len)
	{
		if (k == -1 || s[k] == s[j])
		{
			j++;
			k++;
			if (s[j] == s[k])
			{
				next[k] = k;
			}
			else
			{
				next[j] = k;
			}
		}
		else
		{
			k = next[k];
		}
	}
}
int main()
{
	char s1[300];
	char s2[300];
	fgets(s1, 300, stdin);
	fgets(s2, 300, stdin);
	int next[300];
	get_next(s2, next);
	int i = 0;
	int j = 0;
	int len1 = strlen(s1) - 1;
	int len2 = strlen(s2) - 1;
	while (i < len1 && j < len2)
	{
		if (j == -1 || s1[i] == s2[j])
		{
			i++;
			j++;
		}
		else
		{
			j = next[j];
		}
	}
	if (j == len2)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}